package com.ymatou.iapi.fundstrategy.testcase;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.ObjectUtils.Null;
import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.fundstrategy.parameter.FundStrategy;
import com.ymatou.iapi.fundstrategy.parameter.FundStrategyCreateBean;
import com.ymatou.iapi.fundstrategy.parameter.FundStrategyQueryBean;
import com.ymatou.iapi.fundstrategy.parameter.FundStrategyQueryInfo;
import com.ymatou.iapi.fundstrategy.parameter.FundStrategyinfo;
import com.ymatou.iapi.fundstrategy.parameter.StrategyDetail;
import com.ymatou.iapi.fundstrategy.parameter.YmtFundDimensiongetDimensionid;
import com.ymatou.iapi.fundstrategy.service.FundStrategyCreateCall;
import com.ymatou.iapi.fundstrategy.service.FundStrategyQueryCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.database.model.YmtFundStrategy;
import com.ymttest.database.sqlwapper.YmtFundDimensionWapper;
import com.ymttest.database.sqlwapper.YmtFundStrategyWapper;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
/**
*资金维度查询接口
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_FundStrategyQuery{
	private static FundStrategyQueryBean fundstrategyqueryBean;
	private static FundStrategyQueryCall fundstrategyqueryCall;
	private static FundStrategyCreateCall fundstrategycreateCall;
	private static YmtFundDimensiongetDimensionid ymtFundDDid;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("资金策略查询接口");
	}

	@Before
	public void caseUp() {
		fundstrategyqueryBean=new FundStrategyQueryBean();
		fundstrategyqueryCall=new FundStrategyQueryCall();
		fundstrategycreateCall=new FundStrategyCreateCall();	
		ymtFundDDid= new YmtFundDimensiongetDimensionid();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(fundstrategyqueryCall.getOpurl());
	}
	
	/**
	 * 错误信息断言
	 * @param errcode 错误代码
	 * @param eMsg 错误信息
	 * @throws Exception
	 */
	public void  fundSQgetreturnerrcode(String ecode,String eMsg) throws Exception {
	    try {
	    	
			//获取返回报文的数据
			String dataStr = fundstrategyqueryCall.getReturnData();
			//返回报文断言			
			String fundStrategyResultInfoList =  new JSONObject(dataStr).getString("FundStrategyResultInfoList");
			Logger.verifyIsNull(fundStrategyResultInfoList, "FundStrategyResultInfoList为空");
			String errCode =  new JSONObject(dataStr).getString("ErrCode");
			Logger.verifyIsContains(ecode, errCode, "ErrCode");
			String errMsg =  new JSONObject(dataStr).getString("ErrMsg");
			Logger.verifyIsContains(eMsg, errMsg, eMsg);
			String body =  new JSONObject(dataStr).getString("Body");
			Logger.verifyIsNull(body, "Body为空");
			String requestUrl =  new JSONObject(dataStr).getString("RequestUrl");
			Logger.verifyIsNull(requestUrl, "RequestUrl为空");
			String Success =  new JSONObject(dataStr).getString("Success");
			Logger.verifyIsContains(false, Success, "\"Success\":false");
	    	    	    	
	    }catch (Exception e) {  
	        e.printStackTrace();
	    }  

	}
	
	/**
	 * 当收佣策略查询结果为全局策略时的断言方法
	 * @throws Exception
	 */
	public void  fundSQgetreturnglobalStrategy() throws Exception {
	    try {
	    	
			//ymt_fundstrategy inner join ymt_fundstrategydimension
			YmtFundDimensionWapper ymtFundDimensionWapper = new YmtFundDimensionWapper();	    	
	        List<Map> fundstdi = ymtFundDimensionWapper.selectstrategyidbyrange("100");
	        
			//获取返回报文的数据
			String dataStrQuery = fundstrategyqueryCall.getReturnData();
			//返回报文断言		
			String Success =  new JSONObject(dataStrQuery).getString("Success");
			Logger.verifyIsContains(Success, true, "\"Success\":true");
			String errCode =  new JSONObject(dataStrQuery).getString("ErrCode");
			Logger.verifyIsNull(errCode, "ErrCode等于空");
			String errMsg =  new JSONObject(dataStrQuery).getString("ErrMsg");
			Logger.verifyIsNull(errMsg, "ErrMsg等于空");
			String body =  new JSONObject(dataStrQuery).getString("Body");
			Logger.verifyIsNull(body, "Body等于空");
			String requestUrl =  new JSONObject(dataStrQuery).getString("RequestUrl");
			Logger.verifyIsNull(requestUrl, "RequestUrl等于空");			
			String stid=(String) fundstdi.get(0).get("StrategyId");
			Logger.verifyEquals(stid,  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getString("StrategyId"), "策略Id对比");
			BigDecimal stAmount= (BigDecimal) fundstdi.get(0).get("StrategyAmount"); //数据库查询结果
			double stAmountbyapi=new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyAmount"); //返回报文结果
			Logger.verifyEquals(stAmount,  new BigDecimal(stAmountbyapi).setScale(2,BigDecimal.ROUND_HALF_UP), "策略费率对比");		
			int stlevel= (int) fundstdi.get(0).get("strategyleveltype");						
			Logger.verifyEquals(stlevel,  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getInt("StrategyLevel"), "策略级别对比");

	    	    	    	
	    }catch (Exception e) {  
	        e.printStackTrace();
	    }  

	}
	
	/**
	 * 创建策略查询条件
	 * @param userid 查询人用户ID
	 * @param sttype 策略类型
	 * @param bTime	业务发生时间点
	 * @param sDIdentityId	主数据ID
	 * @return 策略查询条件
	 * @throws Exception
	 */
	public static FundStrategyQueryBean fundStrategyQuerybydataStrCreate(int userid,int sttype,String bTime,String sDIdentityId ,String ssamount,String fdCountryid) throws Exception {
	    try {
	    	String[] fundDimensionidformsql = ymtFundDDid.ymtFundDimensiongetDimensionid();	
	    	
	    	/*FundStrategyQuery接口报文结构
			{
			    "FundStrategyQueryInfoList": [
			        {
			            "DimensionBusinessInfoList": {
			                "4ce2685d-21be-49c8-ab24-bebd84002165": "2",
			                "bbd81ae3-67bb-4000-abad-ddb8fa4062e8": "99",
			                "3111bf89-bac3-4109-8418-13ace475a583": "Y011"
			            },
			            "StrategyType": 1, //策略类型 1收佣策略 2退佣策略 3返佣策略
			            "BusinessTime": "2016-01-13 14:46:08", //业务发生时间点
			            "BusinessMarkId": "自动化测试"	//业务标记id 
			        }
			    ],
			    "UserId": 112233,
			    "UserLoginId": "自动化测试"
			}
			*/
						
			//策略查询条件
			List<FundStrategyQueryInfo> fundStrategyQueryInfo = new ArrayList<FundStrategyQueryInfo>();							
									
			fundstrategyqueryBean.setFundStrategyQueryInfoList(fundStrategyQueryInfo);
			fundstrategyqueryBean.setUserId(userid);
			fundstrategyqueryBean.setUserLoginId("自动化测试");
						
				//接口第二层						
				FundStrategyQueryInfo fsqi1 = new FundStrategyQueryInfo();
				fsqi1.setStrategyType(sttype);
				fsqi1.setBusinessTime(bTime);
				fsqi1.setBusinessMarkId("自动化测试");				
				
					//接口第三层
					HashMap<String, String> dbil1 = new HashMap();
					fsqi1.setDimensionBusinessInfoList(dbil1);				
						dbil1.put(fundDimensionidformsql[0], sDIdentityId);
						dbil1.put(fundDimensionidformsql[1], ssamount);
						dbil1.put(fundDimensionidformsql[2], fdCountryid);
						
				fundStrategyQueryInfo.add(fsqi1);
						
	    	   return fundstrategyqueryBean;
	    }catch (Exception e) {  
	        e.printStackTrace();
	    }  
	    
	    return null;
	}
	
	/**
	 * 根据新老买手、新老客户 查询返佣策略
	 * @param bTime 业务发生时间点
	 * @param sellertype 是否新老买手
	 * @param buyertype	是否新老客户
	 * @return 策略查询条件
	 * @throws Exception
	 */
	public static FundStrategyQueryBean fundStrategyQueryforrefund(String bTime,String sellertype,String buyertype) throws Exception {
	    try {
	    	String[] fundDimensionidformsql = ymtFundDDid.ymtFundDimensiongetDimensionid();		    	
	    	/*FundStrategyQuery接口报文结构
			{	
			    "FundStrategyQueryInfoList": [
			        {
			            "DimensionBusinessInfoList": {
			                "d6fa4a32-3479-4df0-bf3e-c080a02823cd": "1",  	//1新买手2老买手
			            },
			            "StrategyType": 3, //策略类型 1收佣策略 2退佣策略 3返佣策略
			            "BusinessTime": "2017-01-13 14:46:08", //业务发生时间点
			            "BusinessMarkId": "自动化测试"	//业务标记id 
			        },
			        {
			            "DimensionBusinessInfoList": {
			                "bff59bd4-5645-41fe-ba5d-5d5a694acfa5": "1"	//1新客 2老客
			            },
			            "StrategyType": 3, //策略类型 1收佣策略 2退佣策略 3返佣策略
			            "BusinessTime": "2017-01-13 14:46:08", //业务发生时间点
			            "BusinessMarkId": "自动化测试"	//业务标记id 
			        }
			    ],
			    "UserId": 112233,
			    "UserLoginId": "自动化测试"
			}
			*/						
			//策略查询条件
			List<FundStrategyQueryInfo> fundStrategyQueryInfo = new ArrayList<FundStrategyQueryInfo>();																
			fundstrategyqueryBean.setFundStrategyQueryInfoList(fundStrategyQueryInfo);

			
				FundStrategyQueryInfo fsqi1 = new FundStrategyQueryInfo();
				fsqi1.setStrategyType(3);
				fsqi1.setBusinessTime(bTime);
				fsqi1.setBusinessMarkId("自动化测试");								
				HashMap<String, String> dbil1 = new HashMap();
				fsqi1.setDimensionBusinessInfoList(dbil1);				
				dbil1.put(fundDimensionidformsql[3], sellertype);
				
				FundStrategyQueryInfo fsqi2 = new FundStrategyQueryInfo();
				fsqi2.setStrategyType(3);
				fsqi2.setBusinessTime(bTime);
				fsqi2.setBusinessMarkId("自动化测试");								
				HashMap<String, String> dbil2 = new HashMap();
				fsqi2.setDimensionBusinessInfoList(dbil2);				
				dbil2.put(fundDimensionidformsql[4], buyertype);
						
				fundStrategyQueryInfo.add(fsqi1);
				fundStrategyQueryInfo.add(fsqi2);				
				
				fundstrategyqueryBean.setUserId(112233);
				fundstrategyqueryBean.setUserLoginId("自动化测试");
				
	    	   return fundstrategyqueryBean;
	    }catch (Exception e) {  
	        e.printStackTrace();
	    }  
	    
	    return null;
	}	

	
	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_FundStrategyQuery_001() {
		Logger.start(true,"资金策略查询（收佣策略）");
		try {
			//TODO 定义变量	
			//使用维度名称查询维度ID的方法
			String[] fundDimensionidformsql = ymtFundDDid.ymtFundDimensiongetDimensionid();	
			
			//新建一条策略数据					
			FundStrategyCreateBean fundstrategycreateBean = FundStrategy.fundStrategyCreate(1,  		//1为收佣策略
					YMTDateUtil.getBeforeOrNextDay(-100),
					1,		//1特殊策略 2全局策略
					112233,
					"自动化测试人员",
					fundDimensionidformsql[0],	//商品类目维度的Dimensionid
					fundDimensionidformsql[1],	//商品价格维度的Dimensionid
					fundDimensionidformsql[2]); //国家维度的Dimensionid
			
			fundstrategycreateCall.setData(fundstrategycreateBean);
			fundstrategycreateCall.callService();
			
			//获取返回报文的数据
			String dataStrCreate = fundstrategycreateCall.getReturnData();
			//获取返回报文的strategyId值
			String strategyIdbyCreate =  new JSONObject(dataStrCreate).getString("StrategyId");
									
			//FundStrategyQuery方法
			fundStrategyQuerybydataStrCreate(112233, 	//用户id
					1,									//策略类型1收佣 2退佣 3返佣
					YMTDateUtil.getBeforeOrNextDay(0),	//业务发生时间点
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(0).getStrategyDimensionIdentityId(), //策略主数据：商品类目id（Crete接口所传入的值）
					"100",
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(2).getStrategyDimensionIdentityId());	//国家维度
			
						
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();
			
			//获取返回报文的数据
			String dataStrQuery = fundstrategyqueryCall.getReturnData();
			//返回报文断言		
			String Success =  new JSONObject(dataStrQuery).getString("Success");
			Logger.verifyIsContains(Success, true, "\"Success\":true");
			String errCode =  new JSONObject(dataStrQuery).getString("ErrCode");
			Logger.verifyIsNull(errCode, "ErrCode等于空");
			String errMsg =  new JSONObject(dataStrQuery).getString("ErrMsg");
			Logger.verifyIsNull(errMsg, "ErrMsg等于空");
			String body =  new JSONObject(dataStrQuery).getString("Body");
			Logger.verifyIsNull(body, "Body等于空");
			String requestUrl =  new JSONObject(dataStrQuery).getString("RequestUrl");
			Logger.verifyIsNull(requestUrl, "RequestUrl等于空");			
		
			//SQL Ymt_FundStrategy ymtfp库
			YmtFundStrategyWapper ymtFundStrategyWapper = new YmtFundStrategyWapper();			
			List<YmtFundStrategy> strategyIdlist = ymtFundStrategyWapper.selectstrategy(strategyIdbyCreate);
			YmtFundStrategy ymtFundStrategy = strategyIdlist.get(0);
			
			BigDecimal stamount=ymtFundStrategy.getStrategyAmount().setScale(2,BigDecimal.ROUND_HALF_UP);
			BigDecimal stmaxamout=ymtFundStrategy.getStrategyMaxAmount().setScale(1,BigDecimal.ROUND_HALF_UP);
			BigDecimal stminamout=ymtFundStrategy.getStrategyMinAmount().setScale(1,BigDecimal.ROUND_HALF_UP);
			int slt=ymtFundStrategy.getStrategyLevelType(); 	//策略级别
			
			
			String strategyIdbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getString("StrategyId");
			Logger.verifyIsContains(strategyIdbyCreate, strategyIdbyquery, "策略id对比");
			Double strategyAmountbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyAmount");
			Logger.verifyIsContains(stamount, strategyAmountbyquery, "策略费率对比");
			Double strategyMaxAmountbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyMaxAmount");
			Logger.verifyIsContains(stmaxamout, strategyMaxAmountbyquery, "策略最高费用对比");
			Double strategyMinAmountbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyMinAmount");
			Logger.verifyIsContains(stminamout, strategyMinAmountbyquery, "策略最低费用对比");
			int strategyLevelbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getInt("StrategyLevel");
			Logger.verifyIsContains(slt, strategyLevelbyquery, "策略级别对比");
						
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_FundStrategyQuery_002() {
		Logger.start(false,"资金策略类型不能为空");
		try {
			//TODO 补全case代码
			fundstrategyqueryBean.setFundStrategyQueryInfoList(null);
			fundstrategyqueryBean.setUserId(112233);
			fundstrategyqueryBean.setUserLoginId("自动化测试");
			
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();
			
			//errmsg断言
			fundSQgetreturnerrcode("1025","资金策略类型不能为空");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
		
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_FundStrategyQuery_003() {
		Logger.start(false,"资金策略类型不能为空");
		try {
			//TODO 补全case代码
			//使用维度名称查询维度ID的方法
			String[] fundDimensionidformsql = ymtFundDDid.ymtFundDimensiongetDimensionid();	
			
			//新建一条策略数据							
			FundStrategyCreateBean fundstrategycreateBean = FundStrategy.fundStrategyCreate(1,  		//1为收佣策略 2退佣策略 3返佣策略
					YMTDateUtil.getBeforeOrNextDay(-100),
					1,		//1特殊策略 2全局策略
					112233,
					"自动化测试人员",
					fundDimensionidformsql[0],	//商品类目维度的Dimensionid
					fundDimensionidformsql[1],	//商品价格维度的Dimensionid
					fundDimensionidformsql[2]); //国家维度的Dimensionid
			
			fundstrategycreateCall.setData(fundstrategycreateBean);
			fundstrategycreateCall.callService();
			
			//获取返回报文的数据
			String dataStrCreate = fundstrategycreateCall.getReturnData();
			//获取返回报文的strategyId值
			String strategyIdbyCreate =  new JSONObject(dataStrCreate).getString("StrategyId");
						
			fundStrategyQuerybydataStrCreate(112233, 	//用户id
					0,									//策略类型
					YMTDateUtil.getBeforeOrNextDay(0),	//业务发生时间点
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(0).getStrategyDimensionIdentityId(), //策略主数据：商品类目id（Crete接口所传入的值）
					"100",
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(2).getStrategyDimensionIdentityId());	//国家维度
						
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();			
			
			//errmsg断言
			fundSQgetreturnerrcode("1026","资金策略类型不能为空");			
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_FundStrategyQuery_004() {
		Logger.start(false,"维度业务信息集合不能为空");
		try {
			//TODO 补全case代码
			List<FundStrategyQueryInfo> fundStrategyQueryInfo = new ArrayList<FundStrategyQueryInfo>();							
			//接口第一层
			fundstrategyqueryBean.setUserId(112233);
			fundstrategyqueryBean.setUserLoginId("自动化测试");
			fundstrategyqueryBean.setFundStrategyQueryInfoList(fundStrategyQueryInfo);
			
				//接口第二层						
				FundStrategyQueryInfo fsqi1 = new FundStrategyQueryInfo();
				fsqi1.setStrategyType(1);
				fsqi1.setBusinessTime(YMTDateUtil.getBeforeOrNextDay(0));
				fsqi1.setBusinessMarkId("自动化测试");				
				fsqi1.setDimensionBusinessInfoList(null);										
				fundStrategyQueryInfo.add(fsqi1);
			
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();		
			
			//errmsg断言
			fundSQgetreturnerrcode("1027","维度业务信息集合不能为空");	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_FundStrategyQuery_005() {
		Logger.start(false,"业务发生时间点不能为空");
		try {
			//TODO 补全case代码
			//使用维度名称查询维度ID的方法
			String[] fundDimensionidformsql = ymtFundDDid.ymtFundDimensiongetDimensionid();	
			
			//新建一条策略数据		   		
			FundStrategyCreateBean fundstrategycreateBean = FundStrategy.fundStrategyCreate(1,  		//1为收佣策略 2退佣策略 3返佣策略
					YMTDateUtil.getBeforeOrNextDay(-100),
					1,		//1特殊策略 2全局策略
					112233,
					"自动化测试人员",
					fundDimensionidformsql[0],	//商品类目维度的Dimensionid
					fundDimensionidformsql[1],	//商品价格维度的Dimensionid
					fundDimensionidformsql[2]); //国家维度的Dimensionid
			
			

			fundstrategycreateCall.setData(fundstrategycreateBean);
			fundstrategycreateCall.callService();
			
			//获取返回报文的数据
			String dataStrCreate = fundstrategycreateCall.getReturnData();
			//获取返回报文的strategyId值
			String strategyIdbyCreate =  new JSONObject(dataStrCreate).getString("StrategyId");
						
			fundStrategyQuerybydataStrCreate(112233, 	//用户id
					1,									//策略类型
					null,	//业务发生时间点
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(0).getStrategyDimensionIdentityId(), //策略主数据：商品类目id（Crete接口所传入的值）
					"100",
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(2).getStrategyDimensionIdentityId());	//国家维度
									 
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();	

			//errmsg断言
			fundSQgetreturnerrcode("1029","业务发生时间点不能为空");									 		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_FundStrategyQuery_006() {
		Logger.start(false,"用户id不能为空");
		try {
			//TODO 补全case代码
			//使用维度名称查询维度ID的方法
			String[] fundDimensionidformsql = ymtFundDDid.ymtFundDimensiongetDimensionid();	
			
			//新建一条策略数据					
			FundStrategyCreateBean fundstrategycreateBean = FundStrategy.fundStrategyCreate(1, 			 //1为收佣策略 2退佣策略 3返佣策略
					YMTDateUtil.getBeforeOrNextDay(-100),
					1,		//1特殊策略 2全局策略
					112233,
					"自动化测试人员",
					fundDimensionidformsql[0],	//商品类目维度的Dimensionid
					fundDimensionidformsql[1],	//商品价格维度的Dimensionid
					fundDimensionidformsql[2]); //国家维度的Dimensionid
			
			fundstrategycreateCall.setData(fundstrategycreateBean);
			fundstrategycreateCall.callService();
			
			//获取返回报文的数据
			String dataStrCreate = fundstrategycreateCall.getReturnData();
			//获取返回报文的strategyId值
			String strategyIdbyCreate =  new JSONObject(dataStrCreate).getString("StrategyId");
						
			fundStrategyQuerybydataStrCreate(0, 	//用户id
					1,									//策略类型
					YMTDateUtil.getBeforeOrNextDay(0),	//业务发生时间点
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(0).getStrategyDimensionIdentityId(), //策略主数据：商品类目id（Crete接口所传入的值）
					"100",
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(2).getStrategyDimensionIdentityId());	//国家维度
									 
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();	

			//errmsg断言
			fundSQgetreturnerrcode("1006","用户id不能为空");		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
		
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_FundStrategyQuery_007() {
		Logger.start(true,"时间范围内<取特殊策略>");
		try {
			//TODO 补全case代码			 
			//使用维度名称查询维度ID的方法
			String[] fundDimensionidformsql = ymtFundDDid.ymtFundDimensiongetDimensionid();	
			
			//新建一条策略数据					
			FundStrategyCreateBean fundstrategycreateBean = FundStrategy.fundStrategyCreate(1, 			 //1为收佣策略 2退佣策略 3返佣策略
					YMTDateUtil.getBeforeOrNextDay(-100),
					1,		//1特殊策略 2全局策略
					112233,
					"自动化测试人员",
					fundDimensionidformsql[0],	//商品类目维度的Dimensionid
					fundDimensionidformsql[1],	//商品价格维度的Dimensionid
					fundDimensionidformsql[2]); //国家维度的Dimensionid
			
			fundstrategycreateCall.setData(fundstrategycreateBean);
			fundstrategycreateCall.callService();
			
			//获取返回报文的数据
			String dataStrCreate = fundstrategycreateCall.getReturnData();
			//获取返回报文的strategyId值
			String strategyIdbyCreate =  new JSONObject(dataStrCreate).getString("StrategyId");
									
			//FundStrategyQuery方法
			fundStrategyQuerybydataStrCreate(112233, 	//用户id
					1,									//策略类型
					YMTDateUtil.getBeforeOrNextDay(0),	//业务发生时间点
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(0).getStrategyDimensionIdentityId(), //策略主数据：商品类目id（Crete接口所传入的值）
					"100",
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(2).getStrategyDimensionIdentityId());	//国家维度
									
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();
			
			//获取返回报文的数据
			String dataStrQuery = fundstrategyqueryCall.getReturnData();
			//返回报文断言		
			String Success =  new JSONObject(dataStrQuery).getString("Success");
			Logger.verifyIsContains(Success, true, "\"Success\":true");
			String errCode =  new JSONObject(dataStrQuery).getString("ErrCode");
			Logger.verifyIsNull(errCode, "ErrCode等于空");
			String errMsg =  new JSONObject(dataStrQuery).getString("ErrMsg");
			Logger.verifyIsNull(errMsg, "ErrMsg等于空");
			String body =  new JSONObject(dataStrQuery).getString("Body");
			Logger.verifyIsNull(body, "Body等于空");
			String requestUrl =  new JSONObject(dataStrQuery).getString("RequestUrl");
			Logger.verifyIsNull(requestUrl, "RequestUrl等于空");			
		
			//SQL Ymt_FundStrategy ymtfp库
			YmtFundStrategyWapper ymtFundStrategyWapper = new YmtFundStrategyWapper();			
			List<YmtFundStrategy> strategyIdlist = ymtFundStrategyWapper.selectstrategy(strategyIdbyCreate);
			YmtFundStrategy ymtFundStrategy = strategyIdlist.get(0);
			
			BigDecimal stamount=ymtFundStrategy.getStrategyAmount().setScale(2,BigDecimal.ROUND_HALF_UP);
			BigDecimal stmaxamout=ymtFundStrategy.getStrategyMaxAmount().setScale(1,BigDecimal.ROUND_HALF_UP);
			BigDecimal stminamout=ymtFundStrategy.getStrategyMinAmount().setScale(1,BigDecimal.ROUND_HALF_UP);
			int slt=ymtFundStrategy.getStrategyLevelType(); 	//策略级别
			
			
			String strategyIdbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getString("StrategyId");
			Logger.verifyIsContains(strategyIdbyCreate, strategyIdbyquery, "策略id对比");
			Double strategyAmountbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyAmount");
			Logger.verifyIsContains(stamount, strategyAmountbyquery, "策略费率对比");
			Double strategyMaxAmountbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyMaxAmount");
			Logger.verifyIsContains(stmaxamout, strategyMaxAmountbyquery, "策略最高费用对比");
			Double strategyMinAmountbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyMinAmount");
			Logger.verifyIsContains(stminamout, strategyMinAmountbyquery, "策略最低费用对比");
			int strategyLevelbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getInt("StrategyLevel");
			Logger.verifyIsContains(slt, strategyLevelbyquery, "策略级别对比");						
						
		} 
		catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_FundStrategyQuery_008() {
		Logger.start(true,"时间范围外<取全局策略>");
		try {
			//TODO 补全case代码
			String[] fundDimensionidformsql = ymtFundDDid.ymtFundDimensiongetDimensionid();	
			
			//新建一条策略数据					
			FundStrategyCreateBean fundstrategycreateBean = FundStrategy.fundStrategyCreate(1, 			 //1为收佣策略 2退佣策略 3返佣策略
					YMTDateUtil.getBeforeOrNextDay(-100),
					1,		//1特殊策略 2全局策略
					112233,
					"自动化测试人员",
					fundDimensionidformsql[0],	//商品类目维度的Dimensionid
					fundDimensionidformsql[1],	//商品价格维度的Dimensionid
					fundDimensionidformsql[2]); //国家维度的Dimensionid
			
			fundstrategycreateCall.setData(fundstrategycreateBean);
			fundstrategycreateCall.callService();
			
			//获取返回报文的数据
			String dataStrCreate = fundstrategycreateCall.getReturnData();
			//获取返回报文的strategyId值
			String strategyIdbyCreate =  new JSONObject(dataStrCreate).getString("StrategyId");
									
			//FundStrategyQuery方法
			fundStrategyQuerybydataStrCreate(112233, 	//用户id
					1,									//策略类型
					YMTDateUtil.getBeforeOrNextDay(-150),	//业务发生时间点
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(0).getStrategyDimensionIdentityId(), //策略主数据：商品类目id（Crete接口所传入的值）
					"100",
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(2).getStrategyDimensionIdentityId());	//国家维度
			
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();	
			//取全局时的断言
			fundSQgetreturnglobalStrategy();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}	


	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_FundStrategyQuery_009() {
		Logger.start(true,"金额范围外<取全局策略>");
		try {
			//TODO 补全case代码
			String[] fundDimensionidformsql = ymtFundDDid.ymtFundDimensiongetDimensionid();	
			
			//新建一条策略数据					
			FundStrategyCreateBean fundstrategycreateBean = FundStrategy.fundStrategyCreate(1, 			 //1为收佣策略 2退佣策略 3返佣策略
					YMTDateUtil.getBeforeOrNextDay(-100),
					1,		//1特殊策略 2全局策略
					112233,
					"自动化测试人员",
					fundDimensionidformsql[0],	//商品类目维度的Dimensionid
					fundDimensionidformsql[1],	//商品价格维度的Dimensionid
					fundDimensionidformsql[2]); //国家维度的Dimensionid
			
			fundstrategycreateCall.setData(fundstrategycreateBean);
			fundstrategycreateCall.callService();
			
			//获取返回报文的数据
			String dataStrCreate = fundstrategycreateCall.getReturnData();
			//获取返回报文的strategyId值
			String strategyIdbyCreate =  new JSONObject(dataStrCreate).getString("StrategyId");
									
			//FundStrategyQuery方法
			fundStrategyQuerybydataStrCreate(112233, 	//用户id
					1,									//策略类型
					YMTDateUtil.getBeforeOrNextDay(0),	//业务发生时间点
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(0).getStrategyDimensionIdentityId(), //策略主数据：商品类目id（Crete接口所传入的值）
					"1",
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(2).getStrategyDimensionIdentityId());	//国家维度
			
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();	
			
			//取全局时的断言
			fundSQgetreturnglobalStrategy();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}


	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_FundStrategyQuery_010() {
		Logger.start(true,"类目范围外<取全局策略>");
		try {
			//TODO 补全case代码
			String[] fundDimensionidformsql = ymtFundDDid.ymtFundDimensiongetDimensionid();	
			
			//新建一条策略数据					
			FundStrategyCreateBean fundstrategycreateBean = FundStrategy.fundStrategyCreate(1, 			 //1为收佣策略 2退佣策略 3返佣策略
					YMTDateUtil.getBeforeOrNextDay(-100),
					1,		//1特殊策略 2全局策略
					112233,
					"自动化测试人员",
					fundDimensionidformsql[0],	//商品类目维度的Dimensionid
					fundDimensionidformsql[1],	//商品价格维度的Dimensionid
					fundDimensionidformsql[2]); //国家维度的Dimensionid
			
			fundstrategycreateCall.setData(fundstrategycreateBean);
			fundstrategycreateCall.callService();
			
			//获取返回报文的数据
			String dataStrCreate = fundstrategycreateCall.getReturnData();
			//获取返回报文的strategyId值
			String strategyIdbyCreate =  new JSONObject(dataStrCreate).getString("StrategyId");
									
			//FundStrategyQuery方法
			fundStrategyQuerybydataStrCreate(112233, 	//用户id
					1,									//策略类型
					YMTDateUtil.getBeforeOrNextDay(0),	//业务发生时间点
					"509173895713897891798", //策略主数据：商品类目id
					"100",
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(2).getStrategyDimensionIdentityId());	//国家维度
			
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();	
			
			//取全局时的断言
			fundSQgetreturnglobalStrategy();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}	
	
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_FundStrategyQuery_011() {
		Logger.start(true,"国家不一致<取全局策略>");
		try {
			//TODO 补全case代码
			String[] fundDimensionidformsql = ymtFundDDid.ymtFundDimensiongetDimensionid();	
			
			//新建一条策略数据			
			FundStrategyCreateBean fundstrategycreateBean = FundStrategy.fundStrategyCreate(1, 			 //1为收佣策略 2退佣策略 3返佣策略
					YMTDateUtil.getBeforeOrNextDay(-100),
					1,		//1特殊策略 2全局策略
					112233,
					"自动化测试人员",
					fundDimensionidformsql[0],	//商品类目维度的Dimensionid
					fundDimensionidformsql[1],	//商品价格维度的Dimensionid
					fundDimensionidformsql[2]); //国家维度的Dimensionid
			
			fundstrategycreateCall.setData(fundstrategycreateBean);
			fundstrategycreateCall.callService();
			
			//获取返回报文的数据
			String dataStrCreate = fundstrategycreateCall.getReturnData();
			//获取返回报文的strategyId值
			String strategyIdbyCreate =  new JSONObject(dataStrCreate).getString("StrategyId");
									
			//FundStrategyQuery方法
			fundStrategyQuerybydataStrCreate(112233, 	//用户id
					1,									//策略类型
					YMTDateUtil.getBeforeOrNextDay(0),	//业务发生时间点
					"509173895713897891798", //策略主数据：商品类目id
					"100",
					fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(2).getStrategyDimensionIdentityId()+"1");	//国家维度
			
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();
			
			//取全局时的断言
			fundSQgetreturnglobalStrategy();
						        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}			

	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_FundStrategyQuery_012() {
		Logger.start(true,"资金策略查询（退佣策略）");
		try {
			//TODO 补全case代码
			//FundStrategyQuery方法
			fundStrategyQuerybydataStrCreate(112233, 	//用户id
					2,									//策略类型
					YMTDateUtil.getBeforeOrNextDay(0),	//业务发生时间点
					"LM50917", //策略主数据：商品类目id
					"100",
					"GJ1");	//国家维度
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();
			        
			//获取返回报文的数据
			String dataStrQuery = fundstrategyqueryCall.getReturnData();
			//返回报文断言		
			String Success =  new JSONObject(dataStrQuery).getString("Success");
			Logger.verifyIsContains(Success, true, "\"Success\":true");
			String errCode =  new JSONObject(dataStrQuery).getString("ErrCode");
			Logger.verifyIsNull(errCode, "ErrCode等于空");
			String errMsg =  new JSONObject(dataStrQuery).getString("ErrMsg");
			Logger.verifyIsNull(errMsg, "ErrMsg等于空");
			String body =  new JSONObject(dataStrQuery).getString("Body");
			Logger.verifyIsNull(body, "Body等于空");
			String requestUrl =  new JSONObject(dataStrQuery).getString("RequestUrl");
			Logger.verifyIsNull(requestUrl, "RequestUrl等于空");	
			
			//ymt_fundstrategy inner join ymt_fundstrategydimension
			YmtFundDimensionWapper ymtFundDimensionWapper = new YmtFundDimensionWapper();	    	
	        List<Map> fundstdi = ymtFundDimensionWapper.selectstrategybystrategytype("2");
			String stid=(String) fundstdi.get(0).get("StrategyId");
			Logger.verifyEquals(stid,  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getString("StrategyId"), "策略Id对比");
			BigDecimal stAmount= (BigDecimal) fundstdi.get(0).get("StrategyAmount"); //数据库查询结果
			double stAmountbyapi=new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyAmount"); //返回报文结果
			Logger.verifyEquals(stAmount,  new BigDecimal(stAmountbyapi).setScale(2,BigDecimal.ROUND_HALF_UP), "策略费率对比");				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
//	@Test
//	@Category({P3.class})
//	@TestCase
//	public void Tc_FundStrategyQuery_013() {
//		Logger.start(true,"资金策略查询（返佣策略）");
//		try {
//			//TODO 补全case代码
//			 
//			fundStrategyQuerybydataStrCreate(112233, 	//用户id
//					3,									//策略类型
//					YMTDateUtil.getBeforeOrNextDay(0),	//业务发生时间点
//					"LM50917", //策略主数据：商品类目id
//					"100",
//					"GJ1");	//国家维度
//			fundstrategyqueryCall.setData(fundstrategyqueryBean);
//			fundstrategyqueryCall.callService();
//			        
//			//获取返回报文的数据
//			String dataStrQuery = fundstrategyqueryCall.getReturnData();
//			//返回报文断言		
//			String Success =  new JSONObject(dataStrQuery).getString("Success");
//			Logger.verifyIsContains(Success, true, "\"Success\":true");
//			String errCode =  new JSONObject(dataStrQuery).getString("ErrCode");
//			Logger.verifyIsNull(errCode, "ErrCode等于空");
//			String errMsg =  new JSONObject(dataStrQuery).getString("ErrMsg");
//			Logger.verifyIsNull(errMsg, "ErrMsg等于空");
//			String body =  new JSONObject(dataStrQuery).getString("Body");
//			Logger.verifyIsNull(body, "Body等于空");
//			String requestUrl =  new JSONObject(dataStrQuery).getString("RequestUrl");
//			Logger.verifyIsNull(requestUrl, "RequestUrl等于空");	
//			
//			//ymt_fundstrategy inner join ymt_fundstrategydimension
//			YmtFundDimensionWapper ymtFundDimensionWapper = new YmtFundDimensionWapper();	    	
//	        List<Map> fundstdi = ymtFundDimensionWapper.selectstrategybystrategytype("3");
//			String stid=(String) fundstdi.get(0).get("StrategyId");
//			Logger.verifyEquals(stid,  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getString("StrategyId"), "策略Id对比");
//			BigDecimal stAmount= (BigDecimal) fundstdi.get(0).get("StrategyAmount"); //数据库查询结果
//			double stAmountbyapi=new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyAmount"); //返回报文结果
//			Logger.verifyEquals(stAmount,  new BigDecimal(stAmountbyapi).setScale(2,BigDecimal.ROUND_HALF_UP), "策略费率对比");				
//		
//			
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
	
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_FundStrategyQuery_014() {
		Logger.start(true,"返佣策略查询（新买手-新客）");
		try {
			//TODO 补全case代码					
			fundStrategyQueryforrefund(YMTDateUtil.getBeforeOrNextDay(0),
					"1",	//1新买手 2老买手
					"1");	//1新客 2老客
			
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();
			        
			//获取返回报文的数据
			String dataStrQuery = fundstrategyqueryCall.getReturnData();
			//返回报文断言		
			String Success =  new JSONObject(dataStrQuery).getString("Success");
			Logger.verifyIsContains(Success, true, "\"Success\":true");
			String errCode =  new JSONObject(dataStrQuery).getString("ErrCode");
			Logger.verifyIsNull(errCode, "ErrCode等于空");
			String errMsg =  new JSONObject(dataStrQuery).getString("ErrMsg");
			Logger.verifyIsNull(errMsg, "ErrMsg等于空");
			String body =  new JSONObject(dataStrQuery).getString("Body");
			Logger.verifyIsNull(body, "Body等于空");
			String requestUrl =  new JSONObject(dataStrQuery).getString("RequestUrl");
			Logger.verifyIsNull(requestUrl, "RequestUrl等于空");	
			
			//ymt_fundstrategy inner join ymt_fundstrategydimension  查询新买手
			YmtFundDimensionWapper ymtFundDimensionWapper = new YmtFundDimensionWapper();
	    	Map m1 = new HashMap();
	        m1.put("newold", "1"); //1新 2老
	        m1.put("sellerbuyer", "新老买手");
	        List<Map> fundstdi1 = ymtFundDimensionWapper.selectstrategyforrefund(m1);
	        //断言
			String stid1=(String) fundstdi1.get(0).get("StrategyId");
			Logger.verifyEquals(stid1,  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getString("StrategyId"), "策略Id对比");
			BigDecimal stAmount1= (BigDecimal) fundstdi1.get(0).get("StrategyAmount"); //数据库查询结果
			double stAmountbyapi1=new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyAmount"); //返回报文结果
			Logger.verifyEquals(stAmount1,  new BigDecimal(stAmountbyapi1).setScale(2,BigDecimal.ROUND_HALF_UP), "策略费率对比");				
			
			//ymt_fundstrategy inner join ymt_fundstrategydimension  查询新买手
	    	Map m2 = new HashMap();
	        m2.put("newold", "1"); //1新 2老
	        m2.put("sellerbuyer", "新老客");
	        List<Map> fundstdi2 = ymtFundDimensionWapper.selectstrategyforrefund(m2);
	        //断言
			String stid2=(String) fundstdi2.get(0).get("StrategyId");
			Logger.verifyEquals(stid2,  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(1).getString("StrategyId"), "策略Id对比");
			BigDecimal stAmount2= (BigDecimal) fundstdi2.get(0).get("StrategyAmount"); //数据库查询结果
			double stAmountbyapi2=new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(1).getDouble("StrategyAmount"); //返回报文结果
			Logger.verifyEquals(stAmount2,  new BigDecimal(stAmountbyapi2).setScale(2,BigDecimal.ROUND_HALF_UP), "策略费率对比");		
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_FundStrategyQuery_015() {
		Logger.start(true,"返佣策略查询（新买手-老客）");
		try {
			//TODO 补全case代码					
			fundStrategyQueryforrefund(YMTDateUtil.getBeforeOrNextDay(0),
					"1",	//1新买手 2老买手
					"2");	//1新客 2老客
			
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();
			        
			//获取返回报文的数据
			String dataStrQuery = fundstrategyqueryCall.getReturnData();
			//返回报文断言		
			String Success =  new JSONObject(dataStrQuery).getString("Success");
			Logger.verifyIsContains(Success, true, "\"Success\":true");
			String errCode =  new JSONObject(dataStrQuery).getString("ErrCode");
			Logger.verifyIsNull(errCode, "ErrCode等于空");
			String errMsg =  new JSONObject(dataStrQuery).getString("ErrMsg");
			Logger.verifyIsNull(errMsg, "ErrMsg等于空");
			String body =  new JSONObject(dataStrQuery).getString("Body");
			Logger.verifyIsNull(body, "Body等于空");
			String requestUrl =  new JSONObject(dataStrQuery).getString("RequestUrl");
			Logger.verifyIsNull(requestUrl, "RequestUrl等于空");	
			
			//ymt_fundstrategy inner join ymt_fundstrategydimension  查询新买手
			YmtFundDimensionWapper ymtFundDimensionWapper = new YmtFundDimensionWapper();
	    	Map m1 = new HashMap();
	        m1.put("newold", "1"); //1新 2老
	        m1.put("sellerbuyer", "新老买手");
	        List<Map> fundstdi1 = ymtFundDimensionWapper.selectstrategyforrefund(m1);
	        //断言
			String stid1=(String) fundstdi1.get(0).get("StrategyId");
			Logger.verifyEquals(stid1,  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getString("StrategyId"), "策略Id对比");
			BigDecimal stAmount1= (BigDecimal) fundstdi1.get(0).get("StrategyAmount"); //数据库查询结果
			double stAmountbyapi1=new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyAmount"); //返回报文结果
			Logger.verifyEquals(stAmount1,  new BigDecimal(stAmountbyapi1).setScale(2,BigDecimal.ROUND_HALF_UP), "策略费率对比");				
			
			//ymt_fundstrategy inner join ymt_fundstrategydimension  查询新买手
	    	Map m2 = new HashMap();
	        m2.put("newold", "2"); //1新 2老
	        m2.put("sellerbuyer", "新老客");
	        List<Map> fundstdi2 = ymtFundDimensionWapper.selectstrategyforrefund(m2);
	        //断言
			String stid2=(String) fundstdi2.get(0).get("StrategyId");
			Logger.verifyEquals(stid2,  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(1).getString("StrategyId"), "策略Id对比");
			BigDecimal stAmount2= (BigDecimal) fundstdi2.get(0).get("StrategyAmount"); //数据库查询结果
			double stAmountbyapi2=new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(1).getDouble("StrategyAmount"); //返回报文结果
			Logger.verifyEquals(stAmount2,  new BigDecimal(stAmountbyapi2).setScale(2,BigDecimal.ROUND_HALF_UP), "策略费率对比");		
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_FundStrategyQuery_016() {
		Logger.start(true,"返佣策略查询（老买手-新客）");
		try {
			//TODO 补全case代码					
			fundStrategyQueryforrefund(YMTDateUtil.getBeforeOrNextDay(0),
					"2",	//1新买手 2老买手
					"1");	//1新客 2老客
			
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();
			        
			//获取返回报文的数据
			String dataStrQuery = fundstrategyqueryCall.getReturnData();
			//返回报文断言		
			String Success =  new JSONObject(dataStrQuery).getString("Success");
			Logger.verifyIsContains(Success, true, "\"Success\":true");
			String errCode =  new JSONObject(dataStrQuery).getString("ErrCode");
			Logger.verifyIsNull(errCode, "ErrCode等于空");
			String errMsg =  new JSONObject(dataStrQuery).getString("ErrMsg");
			Logger.verifyIsNull(errMsg, "ErrMsg等于空");
			String body =  new JSONObject(dataStrQuery).getString("Body");
			Logger.verifyIsNull(body, "Body等于空");
			String requestUrl =  new JSONObject(dataStrQuery).getString("RequestUrl");
			Logger.verifyIsNull(requestUrl, "RequestUrl等于空");	
			
			//ymt_fundstrategy inner join ymt_fundstrategydimension  查询新买手
			YmtFundDimensionWapper ymtFundDimensionWapper = new YmtFundDimensionWapper();
	    	Map m1 = new HashMap();
	        m1.put("newold", "2"); //1新 2老
	        m1.put("sellerbuyer", "新老买手");
	        List<Map> fundstdi1 = ymtFundDimensionWapper.selectstrategyforrefund(m1);
	        //断言
			String stid1=(String) fundstdi1.get(0).get("StrategyId");
			Logger.verifyEquals(stid1,  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getString("StrategyId"), "策略Id对比");
			BigDecimal stAmount1= (BigDecimal) fundstdi1.get(0).get("StrategyAmount"); //数据库查询结果
			double stAmountbyapi1=new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyAmount"); //返回报文结果
			Logger.verifyEquals(stAmount1,  new BigDecimal(stAmountbyapi1).setScale(2,BigDecimal.ROUND_HALF_UP), "策略费率对比");				
			
			//ymt_fundstrategy inner join ymt_fundstrategydimension  查询新买手
	    	Map m2 = new HashMap();
	        m2.put("newold", "1"); //1新 2老
	        m2.put("sellerbuyer", "新老客");
	        List<Map> fundstdi2 = ymtFundDimensionWapper.selectstrategyforrefund(m2);
	        //断言
			String stid2=(String) fundstdi2.get(0).get("StrategyId");
			Logger.verifyEquals(stid2,  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(1).getString("StrategyId"), "策略Id对比");
			BigDecimal stAmount2= (BigDecimal) fundstdi2.get(0).get("StrategyAmount"); //数据库查询结果
			double stAmountbyapi2=new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(1).getDouble("StrategyAmount"); //返回报文结果
			Logger.verifyEquals(stAmount2,  new BigDecimal(stAmountbyapi2).setScale(2,BigDecimal.ROUND_HALF_UP), "策略费率对比");		
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_FundStrategyQuery_017() {
		Logger.start(true,"返佣策略查询（老买手-老客）");
		try {
			//TODO 补全case代码					
			fundStrategyQueryforrefund(YMTDateUtil.getBeforeOrNextDay(0),
					"2",	//1新买手 2老买手
					"2");	//1新客 2老客
			
			fundstrategyqueryCall.setData(fundstrategyqueryBean);
			fundstrategyqueryCall.callService();
			        
			//获取返回报文的数据
			String dataStrQuery = fundstrategyqueryCall.getReturnData();
			//返回报文断言		
			String Success =  new JSONObject(dataStrQuery).getString("Success");
			Logger.verifyIsContains(Success, true, "\"Success\":true");
			String errCode =  new JSONObject(dataStrQuery).getString("ErrCode");
			Logger.verifyIsNull(errCode, "ErrCode等于空");
			String errMsg =  new JSONObject(dataStrQuery).getString("ErrMsg");
			Logger.verifyIsNull(errMsg, "ErrMsg等于空");
			String body =  new JSONObject(dataStrQuery).getString("Body");
			Logger.verifyIsNull(body, "Body等于空");
			String requestUrl =  new JSONObject(dataStrQuery).getString("RequestUrl");
			Logger.verifyIsNull(requestUrl, "RequestUrl等于空");	
			
			//ymt_fundstrategy inner join ymt_fundstrategydimension  查询新买手
			YmtFundDimensionWapper ymtFundDimensionWapper = new YmtFundDimensionWapper();
	    	Map m1 = new HashMap();
	        m1.put("newold", "2"); //1新 2老
	        m1.put("sellerbuyer", "新老买手");
	        List<Map> fundstdi1 = ymtFundDimensionWapper.selectstrategyforrefund(m1);
	        //断言
			String stid1=(String) fundstdi1.get(0).get("StrategyId");
			Logger.verifyEquals(stid1,  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getString("StrategyId"), "策略Id对比");
			BigDecimal stAmount1= (BigDecimal) fundstdi1.get(0).get("StrategyAmount"); //数据库查询结果
			double stAmountbyapi1=new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyAmount"); //返回报文结果
			Logger.verifyEquals(stAmount1,  new BigDecimal(stAmountbyapi1).setScale(2,BigDecimal.ROUND_HALF_UP), "策略费率对比");				
			
			//ymt_fundstrategy inner join ymt_fundstrategydimension  查询新买手
	    	Map m2 = new HashMap();
	        m2.put("newold", "2"); //1新 2老
	        m2.put("sellerbuyer", "新老客");
	        List<Map> fundstdi2 = ymtFundDimensionWapper.selectstrategyforrefund(m2);
	        //断言
			String stid2=(String) fundstdi2.get(0).get("StrategyId");
			Logger.verifyEquals(stid2,  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(1).getString("StrategyId"), "策略Id对比");
			BigDecimal stAmount2= (BigDecimal) fundstdi2.get(0).get("StrategyAmount"); //数据库查询结果
			double stAmountbyapi2=new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(1).getDouble("StrategyAmount"); //返回报文结果
			Logger.verifyEquals(stAmount2,  new BigDecimal(stAmountbyapi2).setScale(2,BigDecimal.ROUND_HALF_UP), "策略费率对比");		
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
//	@Test
//	@Category({P1.class})
//	@TestCase
//	public void Tc_FundStrategyQuery_018() {
//		Logger.start(true,"资金策略查询（收佣策略-多商品）");
//		try {
//			//TODO 定义变量	
//			//使用维度名称查询维度ID的方法
//			String[] fundDimensionidformsql = ymtFundDDid.ymtFundDimensiongetDimensionid();	
//			
//			//新建一条策略数据					
//			FundStrategyCreateBean fundstrategycreateBean = FundStrategy.fundStrategyCreate(1,  		//1为收佣策略
//					YMTDateUtil.getBeforeOrNextDay(-100),
//					1,		//1特殊策略 2全局策略
//					112233,
//					"自动化测试人员",
//					fundDimensionidformsql[0],	//商品类目维度的Dimensionid
//					fundDimensionidformsql[1],	//商品价格维度的Dimensionid
//					fundDimensionidformsql[2]); //国家维度的Dimensionid			
//			fundstrategycreateCall.setData(fundstrategycreateBean);
//			fundstrategycreateCall.callService();			
//			//获取返回报文的数据
//			String dataStrCreate = fundstrategycreateCall.getReturnData();
//			//获取返回报文的strategyId值
//			String strategyIdbyCreate =  new JSONObject(dataStrCreate).getString("StrategyId");
//			
//			//新建第二条策略数据					
//			FundStrategyCreateBean fundstrategycreateBean2 = FundStrategy.fundStrategyCreate(1,  		//1为收佣策略
//					YMTDateUtil.getBeforeOrNextDay(-100),
//					1,		//1特殊策略 2全局策略
//					112233,
//					"自动化测试人员",
//					fundDimensionidformsql[0],	//商品类目维度的Dimensionid
//					fundDimensionidformsql[1],	//商品价格维度的Dimensionid
//					fundDimensionidformsql[2]); //国家维度的Dimensionid
//			
//			fundstrategycreateCall.setData(fundstrategycreateBean2);
//			fundstrategycreateCall.callService();			
//			//获取返回报文的数据
//			String dataStrCreate2 = fundstrategycreateCall.getReturnData();
//			//获取第二条返回报文的strategyId值
//			String strategyIdbyCreate2 =  new JSONObject(dataStrCreate2).getString("StrategyId");
//			
//			//fundstrategyquery查询接口
//			//策略查询条件
//			List<FundStrategyQueryInfo> fundStrategyQueryInfo = new ArrayList<FundStrategyQueryInfo>();							
//									
//			fundstrategyqueryBean.setFundStrategyQueryInfoList(fundStrategyQueryInfo);
//			fundstrategyqueryBean.setUserId(112233);
//			fundstrategyqueryBean.setUserLoginId("自动化测试");						
//				//接口第二层						
//				FundStrategyQueryInfo fsqi1 = new FundStrategyQueryInfo();
//				fsqi1.setStrategyType(1);
//				fsqi1.setBusinessTime(YMTDateUtil.getBeforeOrNextDay(0));
//				fsqi1.setBusinessMarkId("自动化测试");								
//					//接口第三层
//					HashMap<String, String> dbil1 = new HashMap();
//					fsqi1.setDimensionBusinessInfoList(dbil1);				
//						dbil1.put(fundDimensionidformsql[0], fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(0).getStrategyDimensionIdentityId());
//						dbil1.put(fundDimensionidformsql[1], "100");
//						dbil1.put(fundDimensionidformsql[2], fundstrategycreateBean.getFundStrategy().getStrategyDetailList().get(2).getStrategyDimensionIdentityId());
//					HashMap<String, String> dbil2 = new HashMap();
//					fsqi1.setDimensionBusinessInfoList(dbil2);				
//						dbil1.put(fundDimensionidformsql[0], fundstrategycreateBean2.getFundStrategy().getStrategyDetailList().get(0).getStrategyDimensionIdentityId());
//						dbil1.put(fundDimensionidformsql[1], "100");
//						dbil1.put(fundDimensionidformsql[2], fundstrategycreateBean2.getFundStrategy().getStrategyDetailList().get(2).getStrategyDimensionIdentityId());
//						
//				fundStrategyQueryInfo.add(fsqi1);
//			
//						
//			fundstrategyqueryCall.setData(fundstrategyqueryBean);
//			fundstrategyqueryCall.callService();
//			
//			//获取返回报文的数据
//			String dataStrQuery = fundstrategyqueryCall.getReturnData();
//			//返回报文断言		
//			String Success =  new JSONObject(dataStrQuery).getString("Success");
//			Logger.verifyIsContains(Success, true, "\"Success\":true");
//			String errCode =  new JSONObject(dataStrQuery).getString("ErrCode");
//			Logger.verifyIsNull(errCode, "ErrCode等于空");
//			String errMsg =  new JSONObject(dataStrQuery).getString("ErrMsg");
//			Logger.verifyIsNull(errMsg, "ErrMsg等于空");
//			String body =  new JSONObject(dataStrQuery).getString("Body");
//			Logger.verifyIsNull(body, "Body等于空");
//			String requestUrl =  new JSONObject(dataStrQuery).getString("RequestUrl");
//			Logger.verifyIsNull(requestUrl, "RequestUrl等于空");			
//		
//			//SQL Ymt_FundStrategy ymtfp库
//			YmtFundStrategyWapper ymtFundStrategyWapper = new YmtFundStrategyWapper();			
//			List<YmtFundStrategy> strategyIdlist = ymtFundStrategyWapper.selectstrategy(strategyIdbyCreate);
//			YmtFundStrategy ymtFundStrategy = strategyIdlist.get(0);
//			
//			BigDecimal stamount=ymtFundStrategy.getStrategyAmount().setScale(2,BigDecimal.ROUND_HALF_UP);
//			BigDecimal stmaxamout=ymtFundStrategy.getStrategyMaxAmount().setScale(1,BigDecimal.ROUND_HALF_UP);
//			BigDecimal stminamout=ymtFundStrategy.getStrategyMinAmount().setScale(1,BigDecimal.ROUND_HALF_UP);
//			int slt=ymtFundStrategy.getStrategyLevelType(); 	//策略级别
//			
//			
//			String strategyIdbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getString("StrategyId");
//			Logger.verifyIsContains(strategyIdbyCreate, strategyIdbyquery, "策略id对比");
//			Double strategyAmountbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyAmount");
//			Logger.verifyIsContains(stamount, strategyAmountbyquery, "策略费率对比");
//			Double strategyMaxAmountbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyMaxAmount");
//			Logger.verifyIsContains(stmaxamout, strategyMaxAmountbyquery, "策略最高费用对比");
//			Double strategyMinAmountbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getDouble("StrategyMinAmount");
//			Logger.verifyIsContains(stminamout, strategyMinAmountbyquery, "策略最低费用对比");
//			int strategyLevelbyquery =  new JSONObject(dataStrQuery).getJSONArray("FundStrategyResultInfoList").getJSONObject(0).getInt("StrategyLevel");
//			Logger.verifyIsContains(slt, strategyLevelbyquery, "策略级别对比");
//						
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	
}